import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:honeypotflutter/modules/hire/views/hire_rent_info_item.dart';
import 'package:honeypotflutter/public/views/public_appBar.dart';
import 'package:honeypotflutter/public/views/public_scrollView.dart';
import '../../models/hire_rent_model.dart';
import 'logic.dart';

class HireRentInfoPage extends StatefulWidget {
  const HireRentInfoPage({Key? key}) : super(key: key);

  @override
  State<HireRentInfoPage> createState() => _HireRentInfoPageState();
}

class _HireRentInfoPageState extends State<HireRentInfoPage> {
  final HireRentInfoLogic logic = Get.put(HireRentInfoLogic());
  HireRentModel _itemModel = Get.arguments;
  List<Widget> listWidget = [HireRentInfoItem(showSpeck: false)];

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    if (_itemModel.tmcContractOrderDetails != null) {
      List<Widget> widgetList = _itemModel.tmcContractOrderDetails!.map((e) => HireRentInfoItem(itemModel: e)).toList();
      listWidget.addAll(widgetList);
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: HLAppBar(navigationTitle: "已租格口1", showBottomLine: true),
      body: HLScrollView(
        children: listWidget,
      ),
    );
  }

  @override
  void dispose() {
    Get.delete<HireRentInfoLogic>();
    super.dispose();
  }
}
